home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / c-runtime / README2 < prev   
Encoding:
Text File  |  1992-08-18  |  4.3 KB  |  78 lines

  1. Be sure to do a 'cat README'.
  2.  
  3. This is a run time for the GNU compiler for Objective-C.
  4. It has been donated to the FSF but hasn't been adopted.  Please don't contact them for support until it, or something else, becomes a part of the official release.  I'll help with any problems and questions with the run time until the FSF officially releases something.
  5.  
  6.  
  7. Dennis P. Glatting
  8. Sr. Technical Manager
  9. Trirex Systems Inc.
  10. 315 Post Road West
  11. Westport CT, 06880
  12. (203)221-4600
  13. dennis_glatting@trirex.com
  14.  
  15. 18Aug92
  16.  
  17. This document accompanies set of library routines that I hope will accompany the GNU compiler for Objective C.  It makes the objects go.  It is modeled after the NeXT run time libraries but is different regarding:  Mach library functions, NeXTSTEP library functions, and other things but is comparable, if not equal, to its speed. 
  18.  
  19. The NeXT's run time overhead is 3 and is fixed.  The run-time overhead of the GNU library is 3 -- and can be improved.  Some ideas to reduce overhead include:  
  20. *  Modifying the compiler to produce different code relative to the optimization switch (-Ox).  Function calls could be removed that perform error checking and dispatching.  The philosophy is:  As the confidence in the code increases the less error checking that is necessary.
  21. *  Modify the selector look up mechanism to be a array look up subject to further compiler optimization rather than the pseudo object technique used now.
  22. *  Use C++ for some run time objects that increase the code's reliability and maintainability and could produce code subject to further compiler optimizations.  My personal vote is to modify the run-time to use C++ objects -- but then I was out voted.  What do you think?
  23.  
  24. The run time efficiency of 3 is achieved by compiling the library with the following flags:  -O4 -UDEBUG -DNDEBUG -fomit-frame-pointer.
  25.  
  26. The goal of the run time follows the FSF goal of portability.  The only major difference is that it uses GNU and ANSI C compiler specific functions unlike the GCC which is compilable using a K&R C compiler.
  27.  
  28. The run time library was developed on a NeXT under OS 2.2.  Shortly it will be ported to a Sun.
  29.  
  30. You will noticed that there is some code here and there for mutex locking.  That code is broke.  Eventually I will and thread safety to the run time library.
  31.  
  32. If you are trying to get the run time libraries to work on a NeXT computer there are some things to consider:
  33. *  Another Objective C run time on the NeXT computer is of dubious value.  NeXT has a much richer set of run time functions.
  34. *  There are some patches required to objc-actions.c.  A patched version of objc-actions.c from ss-920814 is included in the patches directory.
  35. *  The default header file config/next.h has some problems under 2.2.  Included in the patches directory is a hacked version.  After you do a "configure next", delete tm.h and create a symbolic link from tm.hack to tm.h.
  36. * Besure to compile objc-actions.c with OBJC_SELECTORS_WITHOUT_LABELS defined.
  37. * There is the notion of constructors.  Yes, that's what I said.  I made a special script to deal with this problem on the NeXT.  Because the compiler has changed many times and I haven't had a problem in a while, I don't know if the compiler is using my script or now handles constructor gathering on its own.  I'll track that down later.
  38. *  The run-time depends on the compiler's header file:  tm.h.  Which depends upon other compiler header files.
  39.   
  40.  
  41. Open issues:
  42. * The run time requires a function be called as "the last constructor".  Currently this is done in main() and needs to be moved to the GNU library.
  43.  
  44. ** Insert more stuff here **
  45.  
  46.  
  47. I have a list of things I want to add to the run-time:
  48. *    Dynamically loadable/unloadable objects.
  49. *    Thread safe (some work and performance will suffer).
  50. *    Garbage collection.
  51. *    Typed streams.
  52. *    Better object versioning and persistence.
  53.  
  54.  
  55. Some performance data:
  56.  
  57. for (i = 0; i < ITERATIONS; ++i)
  58.   func ();
  59. 1000000 iterations, 1 sec  (1e+06/sec)
  60.  
  61. aObj = [ Object new ];
  62. for (i = 0; i < ITERATIONS; ++i)
  63.   [ aObj self ];
  64. 1000000 iterations, 3 sec  (333333.333333/sec)
  65.  
  66. aObj = [ SubClass3 new ];
  67. for (i = 0; i < ITERATIONS; ++i)
  68.   [ aObj self ];
  69.  (-self is implemented two classes up)
  70. 1000000 iterations, 4 sec  (250000/sec)
  71.  
  72. aObj = [ SubClass3 new ];
  73. for (i = 0; i < ITERATIONS; ++i)
  74.   [[ aObj self ] self ];
  75. 1000000 iterations, 10 sec  (100000/sec)
  76.  
  77.  
  78.